package com.xidian.zhiancloud.controller.myyb;

import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.SysBasicSetting;
import com.xidian.zhiancloud.service.myyb.IBasicSetService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统设置-系统个性化设置
 */
@RestController
@RequestMapping("/basicSet")
public class BasicSetController {

    private final static Logger logger = LoggerFactory.
            getLogger(BasicSetController.class);

    @Autowired
    private IBasicSetService basicSettingService;


    /**
     * 查询返回列表页面
     *
     * @param companyId 公司ID
     * @return 返回ResultDTO对象
     */
    @GetMapping("/selectBasicSettingList")
    public ResultDTO<List<SysBasicSetting>> selectBasicSettingList(@RequestParam(value = "companyId", required = true) Long companyId) {
        return ResultDTO.successOf(basicSettingService.selectBasicSettingList(companyId),GeneralResponseEnums.SUCCESS);
    }

    /**
     * 上传添加
     *
     * @param basicSettingList 系统基础信息
     * @return 返回ResultDTO对象
     */
    @PostMapping("/add")
    public ResultDTO<Boolean> add(SysBasicSetting basicSettingList) {
        basicSettingService.save(basicSettingList);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }

}
